home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shs_bellmove.cog < prev    next >
Text File  |  1999-11-15  |  11KB  |  423 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SHS_bellmove.cog    moves bell to upper position & back
  4. #
  5. # [JWC & revised by HB]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ===================================================================
  10.  
  11. symbols
  12.  
  13. # **************************** MESSAGES *****************************
  14.  
  15. message        startup
  16. message        activated
  17. message        arrived
  18. message        user0
  19. message        user1
  20. message        user2
  21.  
  22. # *************************** KEYFRAMES *****************************
  23.  
  24. keyframe    in_handsOnHips=0in_stand4.key            local
  25. keyframe    in_handsToHips=0in_stand1_bd_4.key           local
  26.  
  27. keyframe    in_pull=in_pull_lever_down.key            local
  28. keyframe    lever_down=gen_lever.key                local        
  29.  
  30. # **************************** MODELS *******************************
  31.     
  32.             
  33. # **************************** SOUNDS *******************************
  34.  
  35. sound        in_oops=Inxj089.wav                        local # didn't work
  36. sound        in_nope=Inxj088.wav                        local
  37. sound        in_nobudge=Inxj098.wav                    local
  38. sound        in_hmm=Inxj269.wav                        local
  39.  
  40. sound        leverpull=nub_lever_pull_c.wav            local
  41. sound        leverback=nub_lever_reset_c.wav            local
  42. sound        bellmove=shs_rope.wav                    local
  43. sound        bellstop=shs_statue_stop.wav             local
  44. sound        dooropen=shs_belldoors_open.wav         local
  45. sound        doorclose=shs_belldoors_close.wav        local
  46. sound        whoosh=shs_bellwhoosh_c.wav                local 
  47. sound        musBellrise=mus_shs_bellrising.wav        local 
  48.  
  49.  
  50. # **************************** THINGS *******************************
  51.  
  52. thing        door0                                    # bell doors
  53. thing        door1                                    #
  54. thing        lever                                    # lever
  55. thing        bell
  56. thing        rope0
  57. thing        rope1
  58. thing        rope2
  59. thing        rope3
  60. thing        rope4 
  61. thing        rope5
  62.     
  63. thing        player                                    local
  64. thing        indy                                    nolink
  65.  
  66. thing        bellcam_1                                nolink
  67. thing        bellcam_2                                nolink
  68. thing        bc_t1                                    nolink
  69. thing        bc_t2                                    nolink
  70.  
  71. thing        in_mk1                                    nolink
  72.  
  73. thing        bellGlow                                local
  74.  
  75. thing        bellmark                                local # create on fly
  76. thing        lookmark                                local # create on fly
  77.  
  78. thing        bellumbrella                            #to prevent an "A"bug        
  79.  
  80. # ************************ ENGINE WEIRDNESS *************************
  81.  
  82.     cog            moviecog
  83.     cog            deathbybellcog
  84.  
  85.      sector        marksector                            local # var
  86.     
  87.     template    bellGlow_tpl=shs_bellglow            local
  88.     template    ghost_tpl=ghost                        local
  89.  
  90. # *************************** VARIABLES *****************************
  91.     
  92. vector        camPos                                    local
  93.  
  94. flex        randomValue                                local
  95. flex        newComment=0                            local
  96. flex        oldComment=0                            local
  97. flex        temp                                    local
  98.  
  99. int            leverState=0                            local
  100. int          bellState=0                             local
  101. int            curCam                                    local
  102. int            musicplayed=0                            local        
  103. int            moveloop                                local
  104. int            in_keyTrack1                            local
  105.  
  106. int            pl_rotrate                                local
  107. int            newline=50                                local
  108. int            oldline=50                                local
  109. int            saidoops=0                                local
  110. int            markexists=0                            local
  111.  
  112. # SUB-ROUTINES
  113.  
  114. flex        backtoplay                                local
  115.  
  116.  
  117. end
  118.  
  119. # ===================================================================
  120.  
  121. code
  122.  
  123. # ...................................................................
  124.  
  125. startup:
  126.  
  127.     # Pointer to Player...
  128.     player = GetLocalPlayerThing();
  129.     SetThingFlags(bellumbrella, 0x80000);    # hide invisible collision
  130.  
  131.     return;
  132.  
  133. # ...................................................................
  134.  
  135. activated:
  136.  
  137.     if (GetSenderRef() == lever && leverState == 0)
  138.     {
  139.         leverState = 1;
  140.  
  141.         # Prep for cutscene...
  142.         curCam = GetCurrentCamera();
  143.  
  144.         if (markexists == 0)
  145.         {
  146.             markexists = 1;    
  147.             marksector = FindNewSectorFromThing(player, '-6.74 -0.54 2.09'); # measured spot (was -6.48)
  148.             bellmark =
  149.                 CreateThingAtPos(ghost_tpl, marksector, '-6.74 -0.54 2.09', '0 0 0');
  150.             CaptureThing(bellmark);
  151.             SetThingLVecPYR(bellmark, '0.0 -90.0 0.0');
  152.         }
  153.         
  154.         # Disable and hide player...
  155.         MakeMeStop();
  156.         DeselectWeaponWait(player); # stow any weapon or lighter
  157.         StartCutscene(1);
  158.         CopyPlayerHolsters(player, indy); # make sure our actor has matching props
  159.         
  160.         # Switch actor indy for player...
  161.         TeleportThing(indy, in_mk1);
  162.         SetThingFlags(player, 0x80000); # hide player
  163.         ClearThingFlags(indy, 0x80000); # reveal our actor
  164.  
  165.         pl_rotrate = GetThingMaxRotVel(player);
  166.         SetThingMaxRotVel(indy, 200.0);
  167.         
  168.         # Prep camera & cut...
  169.         SetCameraLookInterp(2, 0); # kill pan & tilt to lock on 2nd target
  170.         SetCameraPosInterp(2, 0); # kill dolly mode too
  171.         SetCameraFocus(2, bellcam_1);
  172.         SetCameraSecondaryFocus(2, bc_t1);
  173.         SetCurrentCamera(2);
  174.         SetCameraFOV(55, 0, 0.0);
  175.         Sleep(0.01);
  176.  
  177.         PlayKey(lever, lever_down, 4, 0x12, 0);
  178.         PlayKey(indy, in_pull, 4, 0x12, 0);
  179.         Sleep(1.2);
  180.         PlaySoundLocal(leverpull, 1.0, 0, 0x0000, 0);
  181.         Sleep(1.4);
  182.         PlaySoundLocal(leverback, 1.0, 0, 0x0000, 0);
  183.         Sleep(0.3);
  184.  
  185.         if (bellState == 0)
  186.         {
  187.             # RT: Indy turns to see what's up...
  188.             AISetLookThingEyeLevel(indy, rope3);
  189.  
  190.             # Lift bell to platform...
  191.             AttachThingToThing(rope0, bell);
  192.             AttachThingToThing(rope1, bell);
  193.             AttachThingToThing(rope2, bell);
  194.             AttachThingToThing(rope3, bell);
  195.             AttachThingToThing(rope4, bell);
  196.             AttachThingToThing(rope5, bell);
  197.             
  198.             if (musicplayed == 0)
  199.             {
  200.                 PlaySoundLocal(musBellrise, 1.0, 0, 0x0, 0);
  201.                 musicplayed = 1;
  202.             }
  203.  
  204.             MoveToFrame(bell, 1, 1.5);
  205.             moveloop=PlaySoundLocal(bellmove, .5, 0, 0x1, 0);
  206.  
  207.             # Pan to watch the bell move up...
  208.  
  209.             # NOTE:  this is a complex dolly, pan, and double tilt move,
  210.             # interping both look & pos and moving the 2nd look-target downward
  211.             # for part of the move, then attaching it to the upward-moving bell
  212.             # in order to frame and follow the bell to its upper resting place.
  213.             # Many of the details depend upon thing placements in the Shambala
  214.             # Sanctuary level, so be careful!
  215.              
  216.             SetCameraLookInterp(2, 1); # enable pan & tilt
  217.             SetCameraPosInterp(2, 1); # set dolly mode
  218.             Sleep(0.01);
  219.             SetCameraInterpSpeed(2, 3.5); # magic numbers
  220.             SetCameraFocus(2, bellcam_2);
  221.             SetCameraSecondaryFocus(2, bc_t2);
  222.             SetCameraFOV(75, 1, 7.5); # match duration of bell move
  223.             MoveToFrame(bc_t2, 1, 3.0); # magic numbers
  224.             Sleep(3.5);
  225.  
  226.             SetCameraLookInterp(2, 0); # kill pan & tilt
  227.             SetCameraPosInterp(2, 0); # kill dolly mode
  228.             Sleep(1.1); # magic number
  229.             StopThing(bc_t2);
  230.             AttachThingToThing(bc_t2, bell);
  231.             
  232.             # No "a" bug
  233.             ClearThingFlags(bellumbrella, 0x80000);    #  collision
  234.             
  235.             # alert deathbybell cog
  236.             SendMessage(deathbybellcog, user1);
  237.             
  238.         }
  239.  
  240.         if (bellState == 2)
  241.         {
  242.             # RT: Indy turns to see what's up...
  243.             AISetLookThingEyeLevel(indy, bell);
  244.             Sleep(0.2);
  245.             
  246.             # Pan to watch...
  247.             SetCameraLookInterp(2, 1); # enable pan & tilt
  248.             SetCameraPosInterp(2, 1); # set dolly mode
  249.             Sleep(0.01);
  250.             SetCameraInterpSpeed(2, 2.5);
  251.             SetCameraFocus(2, bellcam_2);
  252.             SetCameraSecondaryFocus(2, bell);
  253.             SetCameraFOV(60, 1, 9.0); # was 50
  254.             
  255.             # Drop bell to bottom...
  256.             bellState = 3;
  257.             Rotate(door0, 90, 0, 1.0);           
  258.             Rotate(door1, -90, 0, 1.0);
  259.             PlaySoundLocal(dooropen, 1.0, 0, 0, 0);
  260.             Sleep(0.5); 
  261.             SkipToFrame(bell, 0, 1.5);
  262.             moveloop=PlaySoundLocal(bellmove, .5, 0, 0x1, 0);
  263.              
  264.             # alert deathbybell cog
  265.             SendMessage(deathbybellcog, user0);
  266.             
  267.             # make bell umbrella out of play
  268.             SetThingFlags(bellumbrella, 0x80000);    # hide invisible collision
  269.             
  270.         }
  271.  
  272.         if (bellState == 4)
  273.         {
  274.             Sleep(0.5);
  275.             AISetLookThingEyeLevel(indy, bell);
  276.             Sleep(1.0);
  277.  
  278.             AISetMoveSpeed(indy, 0.9);
  279.             AISetMoveThing(indy, bellmark, 0);
  280.             SetCameraLookInterp(2, 1);
  281.             SetCameraInterpSpeed(2, 1.5);
  282.             Sleep(0.01);
  283.             SetCameraSecondaryFocus(2, bellmark);
  284.             SetCameraFOV(65, 1, 1.5);
  285.             Sleep(1.5);
  286.             StopThing(indy);
  287.  
  288.             in_keyTrack1 = PlayKey(indy, in_handsOnHips, 2, 0x10, 0);
  289.             PlayKey(indy, in_handsToHips, 4, 0x12, 1);
  290.  
  291.             while (newline == oldline)
  292.             {        
  293.                 newline = RandBetween(0, 3);
  294.             }
  295.             if (saidoops == 0)
  296.             {
  297.                 newline = 0;
  298.                 saidoops = 1;
  299.             }
  300.             oldline = newline;    
  301.  
  302.             PlayVoice(indy, in_oops[newline], 1.0, 1);
  303.             
  304.             Sleep(0.5);
  305.             StopKey(indy, in_keyTrack1, 0.5);
  306.             Sleep(0.5);
  307.  
  308.             call backtoplay;
  309.         }        
  310.     }
  311.         
  312.     return;
  313.  
  314. # ...................................................................
  315.  
  316. user2:
  317.  
  318.     # NOTE:  This is a signal from moviecog that the bell has been rung and
  319.     # should now ascend to its final frame...
  320.  
  321.     if (GetSenderRef() == moviecog)
  322.     {
  323.         # RT: Bell FX
  324.         bellGlow = CreateThing(bellGlow_tpl, bell);
  325.         AnimateSpriteSize(bellGlow, '0.5 0.5 0.75', '1.5 1.5 0.0', 0.75);
  326.         PlaySoundLocal(whoosh, 1.0, 0, 0, 0);
  327.         bellState = 4; # this will freeze bell at top of tower
  328.         MoveToFrame(bell, 3, 1.5);
  329.         moveloop=PlaySoundLocal(bellmove, .5, 0, 0x1, 0);
  330.     
  331.         # make bell umbrella out of play
  332.         SetThingFlags(bellumbrella, 0x80000);    # no need for this anymore.
  333.     }
  334.     
  335.     return;
  336.             
  337. # ...................................................................
  338.  
  339. arrived:
  340.  
  341.     if (GetSenderRef() == bell && bellState == 0)
  342.     {
  343.         # start door rotation when bell reaches frame 1...
  344.         bellState = 1;
  345.         MoveToFrame(bell, 2, 1.5);
  346.         Sleep(0.5);
  347.         Rotate(door0, -90, 0, 1.0);          
  348.         Rotate(door1, 90, 0, 1.0);
  349.         PlaySoundLocal(doorclose, 1.0, 0, 0, 0);        
  350.     }
  351.  
  352.     if (GetSenderRef() == bell && bellState == 1)
  353.     {
  354.         bellState = 2;
  355.         
  356.         Sleep(1.0); # take a beat for doors
  357.  
  358.         StopSound(moveloop, 0.0);
  359.         PlaySoundLocal(bellstop, 1.0, 0, 0x0, 0);
  360.          
  361.         Sleep(1.0); # take a beat for doors
  362.  
  363.         # Notify controlling cinematic cog that bell is in place...
  364.         SendMessage(moviecog, user1);
  365.          
  366.         TeleportThing(indy, bellmark);
  367.         call backtoplay;
  368.     }
  369.  
  370.     if (GetSenderRef() == bell && bellState == 3)
  371.     {
  372.         bellState = 0;
  373.         StopSound(moveloop, 0.0);
  374.         PlaySoundLocal(bellstop, 1.0, 0, 0x0, 0);
  375.         Sleep(0.5); # take a shorter beat at bottom
  376.  
  377.         # Notify controlling cinematic cog that bell not in place...
  378.         SendMessage(moviecog, user0);
  379.  
  380.         TeleportThing(indy, bellmark);
  381.         call backtoplay;
  382.     }
  383.  
  384.     if (GetSenderRef() == bell && bellState == 4)
  385.     {
  386.         # TO DO: klunk as bell reaches topmost position...
  387.         StopSound(moveloop, 0.0);
  388.         PlaySoundLocal(bellstop, 1.0, 0, 0x0, 0);
  389.  
  390.         # Notify controlling cinematic cog that bell is in place...
  391.         SendMessage(moviecog, user2);         
  392.     }
  393.  
  394.     return;
  395.  
  396. # ...................................................................
  397.  
  398. backtoplay:
  399.     
  400.     # restore player control...
  401.     leverState = 0;
  402.     SetThingMaxRotVel(indy, pl_rotrate);
  403.     Sleep(0.01);
  404.     TeleportThing(player, indy); # move player to actor's spot
  405.     SetThingFlags(indy, 0x80000);
  406.     SetCameraPosition(1, GetThingPOS(bellcam_1));
  407.     ClearThingFlags(player, 0x80000); # player visible
  408.     SetCameraLookInterp(2, 0); # kill pan & tilt mode
  409.     SetCameraPosInterp(2, 0); # kill dolly mode
  410.     Sleep(0.01);
  411.     SetCurrentCamera(curCam);
  412.     ResetCameraFOV(0, 0.0);
  413.  
  414.     # restore the 2nd camera look target...
  415.     DetachThing(bc_t2);
  416.     SkipToFrame(bc_t2, 0, 10.0);
  417.     EndCutscene();
  418.     ClearActorFlags(player, 0x200000); # player in control
  419.         
  420.     return;
  421.    
  422. end
  423.